package nc;
import java.util.Scanner;
public class Q21327 {

    public static void parseString(String words) {
        if (words.length() == 0) {
            return;
        }
        int i = 0;
        while (i < words.length()) {
            for (int j = 0; j < 8; j++) {
                if (i + j < words.length()) {
                    System.out.print(words.charAt(i + j));
                } else {
                    System.out.print('0');
                }
            }
            i = i+8;
            System.out.println();
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = Integer.parseInt(scanner.nextLine());
            for (int i = 0; i < n; i++) {
                parseString(scanner.nextLine());
            }
        }
    }

}
